home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / audio / DAT / commands.y < prev    next >
Encoding:
Text File  |  1994-08-02  |  2.0 KB  |  155 lines

  1. %token LEADIN LEADOUT BOT EOT RATE COPY PROGRAM INDEX PAUSE SILENCE FRAMES FREAD FWRITE SEEK INTEGER BOOLEAN PROGNUM ATIME PTIME COLON WHERE WHERENOT READFRAME QUIT STRING TESTPAT COMMENT 
  2. %{
  3. extern int dat;
  4. static int h,m,s,f;
  5. static int p;
  6. extern char last_string[];
  7. %}
  8. %%
  9. script:    command |
  10.     script command 
  11.     ;
  12. command:    leadin | leadout | rate | copy | program | index | pause | silence | seek | where | wherenot | atime | ptime | readframe | quit | write | read | testpat | comment ;
  13.  
  14. quit: QUIT
  15.     {
  16.         quit();
  17.     }
  18.     ;
  19. where:    WHERE
  20.     {
  21.         get_tape_pos(dat,0);
  22.     }
  23.     ;
  24. wherenot:    WHERENOT
  25.     {
  26.         read_position(dat);
  27.     }
  28.     ;
  29. readframe:    READFRAME
  30.     {
  31.         get_tape_pos(dat,1);
  32.     }
  33.     ;
  34. leadin:    LEADIN
  35.     {
  36.         write_bot(dat);
  37.     }
  38.     ;
  39. leadout: LEADOUT
  40.     {
  41.         write_eot(dat);
  42.     }
  43.     ;
  44. rate:    RATE INTEGER
  45.     {
  46.         set_rate(yylval);
  47.     }
  48.     ;
  49. copy:    COPY BOOLEAN
  50.     {
  51.         copy_prohibit(yylval);
  52.     }
  53.     ;
  54.  
  55. read:    FREAD STRING prog
  56.     {
  57.         read_file(dat,last_string,p,0,0,0,0);
  58.     }
  59.     | FREAD STRING FRAMES INTEGER
  60.     {
  61.         read_frames(dat,last_string,yylval);
  62.     }
  63.     | FREAD STRING timecode
  64.     {
  65.         read_file(dat,last_string,0,h,m,s,f);
  66.     }
  67.     ;
  68.  
  69. write:    FWRITE STRING
  70.     {
  71.         write_file(dat,last_string);
  72.     }
  73.     ;
  74.  
  75. program: PROGRAM
  76.     {
  77.         inc_program();
  78.     }
  79.     | PROGRAM INTEGER 
  80.     {
  81.         set_program(yylval);
  82.     }
  83.     ;
  84.  
  85. index: INDEX
  86.     {
  87.         inc_index();
  88.     }
  89.     | INDEX INTEGER
  90.     {
  91.         set_index(yylval);
  92.     }
  93.     ;
  94.  
  95. pause: PAUSE
  96.     {
  97.         pause();
  98.     }
  99.     ;
  100.  
  101. testpat: TESTPAT INTEGER
  102.     {
  103.         write_testpat(dat,yylval);
  104.     }
  105.     ;
  106.  
  107. silence: SILENCE INTEGER
  108.     {
  109.         write_silence(dat,yylval);
  110.     }
  111.     ;
  112.  
  113. atime: ATIME timecode 
  114.     {
  115.         set_atime(h,m,s,f);
  116.     }
  117.     ;
  118. ptime: PTIME timecode
  119.     {
  120.         set_ptime(h,m,s,f);
  121.     }
  122.     ;
  123. prog: PROGNUM INTEGER { p = yylval; };
  124.  
  125. seek: SEEK ATIME timecode 
  126.     { 
  127.         seek_time(dat,1,h,m,s,f);
  128.     }
  129.       | SEEK PTIME timecode
  130.     {
  131.         seek_time(dat,0,h,m,s,f);
  132.     }
  133.       | SEEK prog 
  134.     {
  135.         seek_prog(dat,p);
  136.     }
  137.       | SEEK BOT
  138.     {
  139.         seek_bot(dat);
  140.     }
  141.       | SEEK EOT
  142.     {
  143.         seek_eot(dat);
  144.     }
  145.       ;
  146.  
  147. hours: INTEGER { h = yylval; };
  148. minutes: INTEGER { m = yylval; };
  149. seconds: INTEGER { s = yylval; };
  150. frames: INTEGER { f = yylval; };
  151.  
  152. timecode: hours COLON minutes COLON seconds COLON frames;
  153.  
  154. comment: COMMENT ;
  155.